package com.controller;
 
import com.meta.SyncType;
import com.service.GrpcClientService;
import com.service.HtMetaInfoSyncClient;
import com.service.MySQLClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
 
 
@RestController
public class GrpcClientController {
 
 
    @Autowired
    private GrpcClientService grpcClientService;

    @Autowired
    private MySQLClientService mySQLClientService;

    @Autowired
    private HtMetaInfoSyncClient htMetaInfoSyncClient;
 
 
    @RequestMapping("/test02")
    public String test02(@RequestParam(defaultValue = "will") String name) {
        return grpcClientService.method01(name);
    }
 
 
    @RequestMapping("/test03")
    public String test03(@RequestParam(defaultValue = "param1") String param1,
                         @RequestParam(defaultValue = "param2") String param2) {
        return grpcClientService.method02(param1, param2);
    }

    @RequestMapping("/executeSql")
    public String executeSql() {
        String sql="select * from t_user ";
        return mySQLClientService.executeSQL(sql);
    }

    @RequestMapping("/htMetaSync")
    public String htMetaSync() {
        String json="";
        return htMetaInfoSyncClient.syncMeta(json, SyncType.ADD);
    }
 
}